package com.artpri.dao.impl;

import java.util.List;

import com.artpri.dao.GoodsAlbumDao;
import com.artpri.model.GoodsAlbum;

/**
 * @author ZhangSi
 */
public class GoodsAlbumDaoImpl extends HibernateDaoImpl<GoodsAlbum> implements GoodsAlbumDao {

	@Override
	public List<GoodsAlbum> getGoodsAlbumByGoods(int goodNum) {
		return find("from GoodsAlbum a where a.goodsNum=?0", goodNum);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<String> getAlbumUrlsByGoods(Integer id) {
		return (List<String>) getSqlQuery("select a.ga_path from goods_album a where a.goods_num=" + id).list();
	}

	@Override
	public GoodsAlbum getGoodsAlbumMainByGoods(int goodNum) {
		return (GoodsAlbum) getQuery("from GoodsAlbum a where a.goodsNum=?0", goodNum).uniqueResult();
	}

}
